﻿@using Website.Models.Domain
@using Website.Models.Styling
@model Website.Models.ViewModels.ProfilesView
@{
    this.ViewBag.Title = "Profiler";
    this.Layout = "~/Views/_Shared/_Layout.cshtml";
}


<div class="float-right smallMarginBottom">
    <input type="button" onclick="@string.Format("location.href = '{0}';", this.Url.Action("CreateProfile"))" value="Opret ny" class="" />
</div>
<table class="tableView">
    <tr>
        @foreach (TableViewHeaderItem item in this.Model.TableHeader.Items)
        {
            <td>
                @Html.Partial("~/Views/_Shared/TableViewHeader.cshtml", item)
            </td>
        }
        <td></td>
    </tr>
    @if (this.Model != null)
    {
        foreach (Profile profile in this.Model.Profiles)
        {
            <tr>
                <td>@profile.Name</td>
                <td>@profile.Relation.Type</td>
                <td>@profile.SubType.Type.Sector.Name</td>
                <td>@profile.SubType.Type.Name</td>
                <td>@profile.CVR</td>
                <td><a href="@Url.Action("UpdateProfile", new { @Id = profile.ID })"><img src="@Url.Content("~/Content/ButtonIcons/tool_blue.png")" alt="Link"/></a></td>
            </tr>
        }
    }


    <tr>
        @Html.Partial("~/Views/_Shared/PagingArrows.cshtml", new PagingArrows { Action = "Index", TotalAmountOfColumns = this.Model.TableHeader.Items.Count()+1, CurrentSkip = this.Model.Skip, CurrentTake = this.Model.Take, CurrentTotalRowCount = this.Model.TotalProfiles, SortAscending = this.Model.SortAscending })
    </tr>
</table>